#ifndef _SHORT_TEST_H
#define _SHORT_TEST_H

#include "stm32f4xx_hal.h"
#include "test_seq.h"
#include "display.h"

/*------------------- Short Test---------------*/
#define ExtAdcCh1Sel(ch) (UserExtPort.ExtAdc1(ch))
#define ExtAdcCh2Sel(ch) (UserExtPort.ExtAdc2(ch))

#define	I_SRC				(float)59
#define	V_DELTA			(float)0.5

//#define	I_SRC				(float)59
//#define	V_DELTA			(float)0.625

void ShortInit(void);
unsigned char ShortForceSet(unsigned char ch1, unsigned char ch2, unsigned char port);
unsigned char ShortSenseSet(unsigned char ch1, unsigned char ch2, unsigned char port);
unsigned char ShortEnableSet(uint8_t IsEn);
void ItemResultPrint(uint8_t*,TestItem*, TypeC_Channel);

extern uint8_t vdrp_sel;
extern uint8_t usbc_mode;

extern TestCycle Short_TestCycle;
extern	uint8_t 	StrTmp[250];
// Test only
void ShortTestFunc(void);

unsigned char TestReady(void);
void MuxDeinit(void);

unsigned char InitTypeCPin(TypeC_Channel input,unsigned char reversal);
void LoggerOneItmPack(uint8_t	*pos, uint8_t *group, uint8_t *item, float value, uint8_t *typ, int32_t open, uint32_t vshort, uint8_t *result);
unsigned char CCpin_Test(uint8_t port,TypeC_Channel input);
uint8_t	DDS2_Test(uint8_t port, TypeC_Channel input, uint32_t	*dds_val_max);
uint8_t	VBUS_DDS2_Test(TypeC_Channel input);

extern TestItem	AdjItem[ADJITEM_NUM];
extern TestItem	GndItem[GNDITEM_NUM];
extern TestItem	VbusItem[VBUSITEM_NUM];
extern TestItem	TRItem[8];
extern TestItem	VOHItem[2];
extern TestItem	VOLItem[2];
extern TestItem	DDS2Item[1];

extern float L_GndValue[GNDITEM_NUM];
extern float R_GndValue[GNDITEM_NUM];
extern float L_VbusValue[VBUSITEM_NUM];
extern float R_VbusValue[VBUSITEM_NUM];
extern float L_AdjValue[ADJITEM_NUM];
extern float R_AdjValue[ADJITEM_NUM];

void ConfigInitItem(void);

#endif
